<?php

namespace XWAM\Addon\POrgUser\Controller;

/**
 * Description of UserTypeController
 *
 * @since 1.0 <2015-11-3> SoChishun <14507247@qq.com> Added.
 */
class UserTypeController extends \XWAM\Controller\AppbaseController {

    public function type_list() {
        $list = AddonD('UserType')->get_paging_list(null, $show, array('ORDERBY' => 'sort, id desc'));
        $this->assign('list', $list);
        $this->assign('page', $show);
        $this->display_cpp();
    }

    public function type_edit($id = 0) {
        if ($id) {
            $this->assign('data', AddonD('UserType')->find($id));
        }
        $this->display();
    }

    function type_edit_save() {
        $result = AddonD('UserType')->save_type();
        $this->dialogJump($result['status'], $result['info']);
    }

    function change_status($id, $status) {
        $this->ajaxReturn(AddonD('UserType')->change_status($id, $status));
    }

    function change_sort($id, $sort) {
        $this->ajaxReturn(AddonD('UserType')->change_sort($id, $sort));
    }

    function type_delete($id = '') {
        $this->ajaxReturn(AddonD('UserType')->delete_type($id));
    }
}
